
#include "service.h"

static device_t *_console_device;

device_t *console_get_device(void)
{
    return _console_device;
}

device_t *console_set_device(const char *name)
{
    device_t *new, *old;

    old = _console_device;  /* Save old device. */
    new = device_find(name);    /* Find new console device */
    if (new != NULL) {
        if (_console_device != NULL) {
            device_close(_console_device);
        }
        device_open(new, 0);
        _console_device = new;
    }
    return old;
}

